package com.gs.mybatismptest.vo;

import cn.mybatis.mp.db.annotations.Fetch;
import cn.mybatis.mp.db.annotations.ResultEntity;
import com.gs.mybatismptest.entity.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;


@Data
@EqualsAndHashCode(callSuper=false)
@ResultEntity(TbUser.class)
public class UserVo extends TbUser{

    @Fetch(source = TbUser.class, property = "id", target = TbAdress.class, targetProperty = "userId")
    private List<TbAdress> tbAdressList = new ArrayList<>();

    @Fetch(source = TbUser.class, property = "id", target = TbBook.class, targetProperty = "userId")
    private List<TbBook> tbBookList = new ArrayList<>();

    @Fetch(source = TbUser.class, property = "id", target = TbDept.class, targetProperty = "userId")
    private List<TbDept> tbDeptList = new ArrayList<>();

    @Fetch(source = TbUser.class, property = "id", target = TbTeacher.class, targetProperty = "userId")
    private List<TbTeacher> tbTeacherList = new ArrayList<>();

}
